﻿using System;
using System.Collections.Generic;
using Cms.Domain;

namespace Cms.Tests.Unit.TestUtils
{

    class MenuTestsHelper
    {

        internal static MenuVersion CreateVersion()
        {
            MenuVersion version = new MenuVersion {ID = 1};
            MenuItem originalParent = new MenuItem()
            {
                ID = 1,
                EndPublishing = new DateTime(2010 - 12 - 30),
                LinkType = MenuItemLinkType.Page,
                MediaFile = new MediaFile { ID = 1 },
                Page = new Page() { ID = 1 },
                Parent = null,
                SortIndex = 1,
                StartPublishing = new DateTime(2010 - 07 - 01),
                Target = "_blank",
                Version = version
            };
            MenuItemTranslation translation = new MenuItemTranslation { Name = "Parent" };
            originalParent.Translations.Add(1, translation);
            version.Items.Add(originalParent);
            MenuItem originalChild = new MenuItem()
            {
                ID = 2,
                EndPublishing = new DateTime(2010 - 12 - 30),
                LinkType = MenuItemLinkType.Page,
                MediaFile = new MediaFile { ID = 1 },
                Page = new Page() { ID = 2 },
                Parent = originalParent,
                SortIndex = 1,
                StartPublishing = new DateTime(2010 - 07 - 01),
                Target = "_blank",
                Version = version
            };
            translation = new MenuItemTranslation { Name = "Child" };
            originalChild.Translations.Add(1, translation);
            originalParent.SubItems.Add(originalChild);
            version.Items.Add(originalChild);
            MenuItem originalGrandChild = new MenuItem()
            {
                ID = 3,
                EndPublishing = new DateTime(2010 - 12 - 30),
                LinkType = MenuItemLinkType.Page,
                MediaFile = new MediaFile { ID = 3 },
                Page = new Page() { ID = 3 },
                Parent = originalChild,
                SortIndex = 1,
                StartPublishing = new DateTime(2010 - 07 - 01),
                Target = "_blank",
                Version = version
            };
            translation = new MenuItemTranslation { Name = "GrandChild" };
            originalGrandChild.Translations.Add(1, translation);
            originalChild.SubItems.Add(originalGrandChild);
            version.Items.Add(originalGrandChild);
            return version;
        }

    }

}
